package com.centon.auto_code.system.controller;

import com.centon.auto_code.system.service.SysRoleService;
import com.centon.auto_code.system.vo.SysAuthorityVo;
import com.centon.auto_code.system.vo.SysRoleVo;
import com.centon.auto_code.system.vo.gen.SuperSysRoleVo.SysRoleController_addEntityInfo;
import com.centon.auto_code.system.vo.gen.SuperSysRoleVo.SysRoleController_deleteEntity;
import com.centon.auto_code.system.vo.gen.SuperSysRoleVo.SysRoleController_modifyEntityInfo;
import com.centon.auto_code.vo.BaseRes;
import com.centon.auto_code.vo.PageData;
import java.util.List;
import javax.annotation.Resource;
import javax.annotation.Title;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("adapi/sysRole")
public class SysRoleController {

    @Resource
    private SysRoleService sysRoleService;

    /**
     * @gen_340_lwl
     * 角色列表
     * 角色列表
     * @param sysRoleVo
    **/
    @Title("角色列表")
    @ResponseBody
    @RequestMapping(value="entityPage", method=RequestMethod.GET)
    public BaseRes<PageData<SysRoleVo>> entityPage(SysRoleVo sysRoleVo) {
        return sysRoleService.entityPage(sysRoleVo);
    }
    /**
     * @gen_341_lwl
     * 角色详情
     * null
     * @param id
    **/
    @Title("角色详情")
    @ResponseBody
    @RequestMapping(value="entityInfo/{id}", method=RequestMethod.GET)
    public BaseRes<SysRoleVo> entityInfo(@PathVariable("id") String id) {
        return sysRoleService.entityInfo(id);
    }
    /**
     * @gen_342_lwl
     * 角色删除
     * null
     * @param sysRoleVo
    **/
    @Title("角色删除")
    @ResponseBody
    @RequestMapping(value="entityInfo", method=RequestMethod.DELETE)
    public BaseRes<String> deleteEntity(@RequestBody @Validated(SysRoleController_deleteEntity.class) SysRoleVo sysRoleVo, BindingResult bindingResult) {
        return sysRoleService.deleteEntity(sysRoleVo.getId());
    }
    /**
     * @gen_343_lwl
     * 角色添加
     * null
     * @param sysRoleVo
    **/
    @Title("角色添加")
    @ResponseBody
    @RequestMapping(value="entityInfo", method=RequestMethod.POST)
    public BaseRes<String> addEntityInfo(@RequestBody @Validated(SysRoleController_addEntityInfo.class) SysRoleVo sysRoleVo, BindingResult bindingResult) {
        return sysRoleService.addEntityInfo(sysRoleVo);
    }
    /**
     * @gen_344_lwl
     * 角色修改
     * null
     * @param sysRoleVo
    **/
    @Title("角色修改")
    @ResponseBody
    @RequestMapping(value="entityInfo", method=RequestMethod.PUT)
    public BaseRes<String> modifyEntityInfo(@RequestBody @Validated(SysRoleController_modifyEntityInfo.class) SysRoleVo sysRoleVo, BindingResult bindingResult) {
        return sysRoleService.modifyEntityInfo(sysRoleVo);
    }
    /**
     * @gen_377_lwl
     * 获取全部权限列表
     * null
    **/
    @Title("获取全部权限列表")
    @ResponseBody
    @RequestMapping(value="queryAllAuthoritys", method=RequestMethod.GET)
    public BaseRes<List<SysAuthorityVo>> queryAllAuthoritys() {
        return sysRoleService.queryAllAuthoritys();
    }
}